home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / clipper / ks94an.zip / FPEEKBYT.HDR < prev    next >
Text File  |  1994-04-25  |  2KB  |  59 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _FPeekByte( nHandle, nMode, nBytes ) --> cString
  8.  
  9. PARAMETERS:
  10.  
  11. nHandle : File handle from previous fopen()
  12. nMode   : 1 (KFP_NEXT) - next bytes (DEFAULT)
  13.         : 2 (KFP_PREV) - previous bytes
  14. nBytes  : Number of bytes to read (DEFAULT: 1 byte)
  15.  
  16. SHORT:
  17.  
  18. Read bytes before or after the current position without moving file pointer
  19.  
  20. DESCRIPTION:
  21.  
  22. _FPeekByte() allows you to look ahead at incoming bytes, or take a look
  23. a previous bytes without moving the current file pointer.  This is handy when
  24. you need to know something about the upcoming bytes, or need to take another
  25. look at previous bytes without losing your current position.
  26.  
  27. This is essentialy the same thing as simply making note of the current file
  28. pointer, going about your business, then FSEEK()ing your old position.  This
  29. is just much easier and requires no variable declarations on your part.
  30.  
  31. NOTE:
  32.  
  33.  
  34.  
  35. EXAMPLE:
  36.  
  37. t = fopen('THE_CRYPT.AGH')
  38.  
  39. fseek(t,100,FS_SET)     // now sitting at byte 100
  40.  
  41. fread(t,@data,1)
  42.  
  43. if data = chr(13)
  44.  
  45.     ? 'Yikes!'
  46.  
  47.     if _FPeekByte(t,KFP_NEXT,1) = chr(10)
  48.  
  49.         ? 'There is a two headed CRLF pair standing in the   '
  50.         ? 'entrance to the crypt.  You are about to be eaten '
  51.         ? 'by a grue. Goodbye...'
  52.  
  53.     endif
  54.  
  55. endif
  56.  
  57.  
  58. ******************************************************************************/
  59.